#define BOOST_TEST_MODULE testElementEdge

#include <boost/test/unit_test.hpp>

#include "common/elements/element_maker.h"
#include "common/elements/edge.h"

BOOST_AUTO_TEST_CASE(testEdgeJson)
{
    auto first = std::make_shared<Elements::Edge>();
    first->setId(1);
    first->setBeginStateId(2);
    first->setEndStateId(3);

    const auto json = first->toJsonString();
    const Elements::ElementPtr second(Elements::fromJsonString(json));
    BOOST_CHECK(first->isSame(second.get()));

    const auto third = std::static_pointer_cast<Elements::Edge>(second);
    BOOST_CHECK(1 == third->id());
    BOOST_CHECK(2 == third->beginStateId());
    BOOST_CHECK(3 == third->endStateId());
}
